package br.com.cslsp.teste;

import java.io.Serializable;

import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.jboss.logging.Logger;

import br.com.bb.cslsp.ejb.dao.dependencia.DependenciaDAO;
import br.com.bb.cslsp.modelo.dependencia.Dependencia;

import com.ocpsoft.pretty.faces.annotation.URLAction;
import com.ocpsoft.pretty.faces.annotation.URLMapping;

@Named
@RequestScoped
@URLMapping(id="teste", pattern="/testando/#{testeBean.url}", viewId="/teste.xhtml")
public class TesteBean implements Serializable {

	private static final long serialVersionUID = 6825472367932175211L;

	@Inject
	private transient Logger logger;
	
	@EJB
	private DependenciaDAO dao;
	
	private String url;
	
	private String texto = "inicial";

	public void alterar() {
		Dependencia d = new Dependencia();
		d = dao.buscaPorId(7421, 0);
//		this.texto = d.getNome();
		this.url = this.texto;
		logger.info(d.getNome());
		logger.error("erro no LOGGG!!!!");
		logger.debug("deebugando");
		logger.warn("warnizando");
	}
	
	@URLAction
	public void alterarUrl() {
		this.texto = url;
	}
	
	public String getTexto() {
		return texto;
	}

	public void setTexto(String texto) {
		this.texto = texto;
	}
	
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

}
